package LeiandObject;

public class Graphical {
    final static double PI = 3.14;   //创建静态常量

    public static void main(String[] args) {
        Circular cir = new Circular(3.0);
        Spherical sph = new Spherical(3.0);
        cir.setRadius(10);
        double m = cir.getRadius();

        System.out.println("hh" + m);
    }
}

class Circular { //创建一个圆类
    double radius;  //创建圆的属性
    double area;

    public double getRadius() {
        return radius;
    }

    public void setRadius(double radius) {
        this.radius = radius;
    }

    public double getArea() {
        return area;
    }

    public void setArea(double area) {
        this.area = area;
    }

    public Circular(double radius) { //创建一个带参数的圆的构造方法
        this.radius = radius;   //使用this关键字赋值获得圆的半径


        area = Graphical.PI * radius * radius;

        System.out.println("圆的半径：" + radius);
        System.out.println("圆的面积：" + area);
    }
}

class Spherical {    //创建一个球类
    double radius;
    double volumn;

    public Spherical(double radius) {    //创建球的构造方法
        this.radius = radius;
        volumn = 4 / 3 * Graphical.PI * radius * radius;

        System.out.println("球的半径：" + radius);
        System.out.println("球的面积：" + volumn);

    }
}